/**
 * @date 3:15:47 PM
 * SMSAPPServiceImpl.java
 * Administrator
 * TODO
 */
package com.qs.education.service.impl;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;

import com.qs.education.bean.api.ResponseBean;
import com.qs.education.bean.beans.EducationSMSResponse;
import com.qs.education.bean.service.BaseService;
import com.qs.education.bean.utils.IpUtil;
import com.qs.education.service.ISMSAPPService;

/**
 * @class SMSAPPServiceImpl	
 * @author Warren
 * @description
 * @date Nov 5, 2018 
 */
@Service
public class SMSAPPServiceImpl extends BaseService implements ISMSAPPService{

	/**
	 * @author Warren
	 * @param mobile 手机号
	 * @param sendType 发送类型 ->学生用户 ->教师用户
	 * @param request 请求对象，获取客户端ip地址使用。
	 * @return EducationSMSResponse
	 * @description 根据手机号给用户发送短信
	 * @date Nov 5, 2018
	 */
	@Override
	public EducationSMSResponse getSMS(String mobile,int sendType,HttpServletRequest request) {
		String ip = IpUtil.getIpAdrress(request);
		EducationSMSResponse educationSMSResponse = apiCaller.getSMS(mobile,sendType,ip);
		return educationSMSResponse;
	}

	/**
	 * @author Warren
	 * @param mobile 手机号
	 * @param code 验证码
	 * @return EducationSMSResponse
	 * @description 用户发送的验证码与后台存储的进行校验
	 * @date Nov 5, 2018
	 */
	@Override
	public ResponseBean checkSMS(String mobile, String code) {
		ResponseBean ResponseBean = apiCaller.checkSMS(mobile,code);
		return ResponseBean;
	}
	
}
